package com.yingside.system.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yingside.common.util.ResultVO;
import com.yingside.system.model.User;
import com.yingside.system.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author yingside
 * @since 2020-12-30
 */
@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private IUserService userService;

    @GetMapping("/index")
    public String index(){
        System.out.println("=====UserController.index=====");
        return "user/user-list";
    }

    @GetMapping("/list")
    @ResponseBody
    public ResultVO getList(Integer page, Integer limit, User userQuery){
        System.out.println("====UserController.getList====");
        System.out.println("userQuery = " + userQuery);
        IPage<User> userPage = userService.selectAllWithDept(page, limit, userQuery);
        return ResultVO.success(userPage);
    }
}
